#include "bytematrixtest.h"
#include <newcode/ByteMatrix.h>

using namespace newcode;

void ByteMatrixTest::byteMatrixTets1()
{
    ByteMatrix matrix(2, 2);
    matrix(0, 0) = 1;
    matrix(0, 1) = 2;
    matrix(1, 0) = 3;
    matrix(1, 1) = 4;

    QCOMPARE((int)matrix(0, 0), 1);
    QCOMPARE((int)matrix(0, 1), 2);
    QCOMPARE((int)matrix(1, 0), 3);
    QCOMPARE((int)matrix(1, 1), 4);
}

void ByteMatrixTest:: setRowTest()
{
    ByteMatrix matrix(2, 2);
    unsigned char array1[] = {1, 2};
    unsigned char array2[] = {3, 4};
    matrix.setRow(array1, 0);
    matrix.setRow(array2, 1);
    QCOMPARE((int)matrix(0, 0), 1);
    QCOMPARE((int)matrix(1, 0), 2);
    QCOMPARE((int)matrix(0, 1), 3);
    QCOMPARE((int)matrix(1, 1), 4);
}
